Skip to content

Conversation

@XuKang371322
Copy link

I made the following changes:
len(ImageList) >> fileListWidget.count
ImageList.index(text) >> findListRow(text)
ImageList[text] >> fileListWidget.findItems(text)

This is my first time submitting a PR to this project. Thank you for the opportunity to contribute. If there are any issues with my code or the PR process, or if any changes are needed, please don't hesitate to let me know. I'm more than happy to learn and make revisions. Thank you for your time and review!

@wkentaro
Copy link
Owner

wkentaro commented Oct 5, 2025

can you add a brief description why the new implementation is better? e.g., Before/After screenshots.

i.e., is this a feature or refactoring?

image

Copy link
Owner

@wkentaro wkentaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for your pr @XuKang371322, and congrats on making the first one.

.gitignore Outdated
.DS_Store
.idea/
/.vscode
/run.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Those were my local editor files. Removed the .vscode and updated the PR.

labelme/app.py Outdated
self.importDirImages(filename, load=False)
else:
self.filename = filename
self.filename:str|types.NoneType = filename
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add from __future__ import annotations so that this is compatible with python3.9

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip! I've added from future import annotations to the files for 3.9 compatibility.

@XuKang371322
Copy link
Author

can you add a brief description why the new implementation is better? e.g., Before/After screenshots.

i.e., is this a feature or refactoring?

image

This is a ​​refactoring​​ for better performance and clarity.
For example:
Replaced len(self.imageList)with self.fileListWidget.count()(O(1) vs O(n))
Used findItems()instead of manual iteration for faster lookups
These changes make the code more efficient and readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants